;;;; -*- mode: Scheme; -*-

(define SDL-PIXELFORMAT-UNKNOWN     SDL_PIXELFORMAT_UNKNOWN)
(define SDL-PIXELFORMAT-INDEX1LSB   SDL_PIXELFORMAT_INDEX1LSB)
(define SDL-PIXELFORMAT-INDEX1MSB   SDL_PIXELFORMAT_INDEX1MSB)
(define SDL-PIXELFORMAT-INDEX4LSB   SDL_PIXELFORMAT_INDEX4LSB)
(define SDL-PIXELFORMAT-INDEX4MSB   SDL_PIXELFORMAT_INDEX4MSB)
(define SDL-PIXELFORMAT-INDEX8      SDL_PIXELFORMAT_INDEX8)
(define SDL-PIXELFORMAT-RGB332      SDL_PIXELFORMAT_RGB332)
(define SDL-PIXELFORMAT-RGB444      SDL_PIXELFORMAT_RGB444)
(define SDL-PIXELFORMAT-RGB555      SDL_PIXELFORMAT_RGB555)
(define SDL-PIXELFORMAT-BGR555      SDL_PIXELFORMAT_BGR555)
(define SDL-PIXELFORMAT-ARGB4444    SDL_PIXELFORMAT_ARGB4444)
(define SDL-PIXELFORMAT-RGBA4444    SDL_PIXELFORMAT_RGBA4444)
(define SDL-PIXELFORMAT-ABGR4444    SDL_PIXELFORMAT_ABGR4444)
(define SDL-PIXELFORMAT-BGRA4444    SDL_PIXELFORMAT_BGRA4444)
(define SDL-PIXELFORMAT-ARGB1555    SDL_PIXELFORMAT_ARGB1555)
(define SDL-PIXELFORMAT-RGBA5551    SDL_PIXELFORMAT_RGBA5551)
(define SDL-PIXELFORMAT-ABGR1555    SDL_PIXELFORMAT_ABGR1555)
(define SDL-PIXELFORMAT-BGRA5551    SDL_PIXELFORMAT_BGRA5551)
(define SDL-PIXELFORMAT-RGB565      SDL_PIXELFORMAT_RGB565)
(define SDL-PIXELFORMAT-BGR565      SDL_PIXELFORMAT_BGR565)
(define SDL-PIXELFORMAT-RGB24       SDL_PIXELFORMAT_RGB24)
(define SDL-PIXELFORMAT-BGR24       SDL_PIXELFORMAT_BGR24)
(define SDL-PIXELFORMAT-RGB888      SDL_PIXELFORMAT_RGB888)
(define SDL-PIXELFORMAT-RGBX8888    SDL_PIXELFORMAT_RGBX8888)
(define SDL-PIXELFORMAT-BGR888      SDL_PIXELFORMAT_BGR888)
(define SDL-PIXELFORMAT-BGRX8888    SDL_PIXELFORMAT_BGRX8888)
(define SDL-PIXELFORMAT-ARGB8888    SDL_PIXELFORMAT_ARGB8888)
(define SDL-PIXELFORMAT-RGBA8888    SDL_PIXELFORMAT_RGBA8888)
(define SDL-PIXELFORMAT-ABGR8888    SDL_PIXELFORMAT_ABGR8888)
(define SDL-PIXELFORMAT-BGRA8888    SDL_PIXELFORMAT_BGRA8888)
(define SDL-PIXELFORMAT-ARGB2101010 SDL_PIXELFORMAT_ARGB2101010)
(define SDL-PIXELFORMAT-RGBA32      SDL_PIXELFORMAT_RGBA32)
(define SDL-PIXELFORMAT-ARGB32      SDL_PIXELFORMAT_ARGB32)
(define SDL-PIXELFORMAT-BGRA32      SDL_PIXELFORMAT_BGRA32)
(define SDL-PIXELFORMAT-ABGR32      SDL_PIXELFORMAT_ABGR32)
(define SDL-PIXELFORMAT-YV12        SDL_PIXELFORMAT_YV12)
(define SDL-PIXELFORMAT-IYUV        SDL_PIXELFORMAT_IYUV)
(define SDL-PIXELFORMAT-YUY2        SDL_PIXELFORMAT_YUY2)
(define SDL-PIXELFORMAT-UYVY        SDL_PIXELFORMAT_UYVY)
(define SDL-PIXELFORMAT-YVYU        SDL_PIXELFORMAT_YVYU)
(define SDL-PIXELFORMAT-NV12        SDL_PIXELFORMAT_NV12)
(define SDL-PIXELFORMAT-NV21        SDL_PIXELFORMAT_NV21)

(define SDL-RENDERER-SOFTWARE       SDL_RENDERER_SOFTWARE)
(define SDL-RENDERER-ACCELERATED    SDL_RENDERER_ACCELERATED)
(define SDL-RENDERER-PRESENT-VSYNC  SDL_RENDERER_PRESENTVSYNC)
(define SDL-RENDERER-TARGET-TEXTURE SDL_RENDERER_TARGETTEXTURE)

(define SDL-TEXTUREACCESS-STATIC    SDL_TEXTUREACCESS_STATIC)
(define SDL-TEXTUREACCESS-STREAMING SDL_TEXTUREACCESS_STREAMING)
(define SDL-TEXTUREACCESS-TARGET    SDL_TEXTUREACCESS_TARGET)

(define SDL-FLIP-NONE       SDL_FLIP_NONE)
(define SDL-FLIP-HORIZONTAL SDL_FLIP_HORIZONTAL)
(define SDL-FLIP-VERTICAL   SDL_FLIP_VERTICAL)

(define SDL-BLENDMODE-NONE    SDL_BLENDMODE_NONE)
(define SDL-BLENDMODE-BLEND   SDL_BLENDMODE_BLEND)
(define SDL-BLENDMODE-ADD     SDL_BLENDMODE_ADD)
(define SDL-BLENDMODE-MOD     SDL_BLENDMODE_MOD)
(define SDL-BLENDMODE-INVALID SDL_BLENDMODE_INVALID)

(define SDL-BLENDOPERATION-ADD          SDL_BLENDOPERATION_ADD)
(define SDL-BLENDOPERATION-SUBTRACT     SDL_BLENDOPERATION_SUBTRACT)
(define SDL-BLENDOPERATION-REV-SUBTRACT SDL_BLENDOPERATION_REV_SUBTRACT)
(define SDL-BLENDOPERATION-MINIMUM      SDL_BLENDOPERATION_MINIMUM)
(define SDL-BLENDOPERATION-MAXIMUM      SDL_BLENDOPERATION_MAXIMUM)

(define SDL-BLENDFACTOR-ZERO                SDL_BLENDFACTOR_ZERO)
(define SDL-BLENDFACTOR-ONE                 SDL_BLENDFACTOR_ONE)
(define SDL-BLENDFACTOR-SRC-COLOR           SDL_BLENDFACTOR_SRC_COLOR)
(define SDL-BLENDFACTOR-ONE-MINUS-SRC-COLOR SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR)
(define SDL-BLENDFACTOR-SRC-ALPHA           SDL_BLENDFACTOR_SRC_ALPHA)
(define SDL-BLENDFACTOR-ONE-MINUS-SRC-ALPHA SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA)
(define SDL-BLENDFACTOR-DST-COLOR           SDL_BLENDFACTOR_DST_COLOR)
(define SDL-BLENDFACTOR-ONE-MINUS-DST-COLOR SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR)
(define SDL-BLENDFACTOR-DST-ALPHA           SDL_BLENDFACTOR_DST_ALPHA)
(define SDL-BLENDFACTOR-ONE-MINUS-DST-ALPHA SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA)



(define SDL-SYSTEM-CURSOR-ARROW       0)
(define SDL-SYSTEM-CURSOR-IBEAM       1)
(define SDL-SYSTEM-CURSOR-WAIT        2)
(define SDL-SYSTEM-CURSOR-CROSSHAIR   3)
(define SDL-SYSTEM-CURSOR-WAIT-ARROW  4)
(define SDL-SYSTEM-CURSOR-SIZE-NWSE   5)
(define SDL-SYSTEM-CURSOR-SIZE-NESW   6)
(define SDL-SYSTEM-CURSOR-SIZE-WE     7)
(define SDL-SYSTEM-CURSOR-SIZE-NS     8)
(define SDL-SYSTEM-CURSOR-SIZE-ALL    9)
(define SDL-SYSTEM-CURSOR-NO         10)
(define SDL-SYSTEM-CURSOR-HAND       11)

(define SDL-HAPTIC-CONSTANT     (bitwise-arithmetic-shift-left 1 0))
(define SDL-HAPTIC-SINE         (bitwise-arithmetic-shift-left 1 1))
(define SDL-HAPTIC-LEFTRIGHT    (bitwise-arithmetic-shift-left 1 2))
(define SDL-HAPTIC-TRIANGLE     (bitwise-arithmetic-shift-left 1 3))
(define SDL-HAPTIC-SAWTOOTHUP   (bitwise-arithmetic-shift-left 1 4))
(define SDL-HAPTIC-SAWTOOTHDOWN (bitwise-arithmetic-shift-left 1 5))
(define SDL-HAPTIC-RAMP         (bitwise-arithmetic-shift-left 1 6))
(define SDL-HAPTIC-SPRING       (bitwise-arithmetic-shift-left 1 7))
(define SDL-HAPTIC-DAMPER       (bitwise-arithmetic-shift-left 1 8))
(define SDL-HAPTIC-INERTIA      (bitwise-arithmetic-shift-left 1 9))
(define SDL-HAPTIC-FRICTION     (bitwise-arithmetic-shift-left 1 10))
(define SDL-HAPTIC-CUSTOM       (bitwise-arithmetic-shift-left 1 11))
(define SDL-HAPTIC-GAIN         (bitwise-arithmetic-shift-left 1 12))
(define SDL-HAPTIC-AUTOCENTER   (bitwise-arithmetic-shift-left 1 13))
(define SDL-HAPTIC-STATUS       (bitwise-arithmetic-shift-left 1 14))
(define SDL-HAPTIC-PAUSE        (bitwise-arithmetic-shift-left 1 15))

(define SDL-HAPTIC-POLAR        0)
(define SDL-HAPTIC-CARTESIAN    1)
(define SDL-HAPTIC-SPHERICAL    2)
(define SDL-HAPTIC-INFINITY     4294967295)

(define SDL-CONTROLLER-BINDTYPE-NONE   0)
(define SDL-CONTROLLER-BINDTYPE-BUTTON 1)
(define SDL-CONTROLLER-BINDTYPE-AXIS   2)
(define SDL-CONTROLLER-BINDTYPE-HAT    3)


(define SDL-TRUE    1)
(define SDL-FALSE   0)

(define SDL-QUERY  -1)
(define SDL-IGNORE  0)
(define SDL-DISABLE 0)
(define SDL-ENABLE  1)

(define SDL-INIT-TIMER          #x00000001)
(define SDL-INIT-AUDIO          #x00000010)
(define SDL-INIT-VIDEO          #x00000020)
(define SDL-INIT-JOYSTICK       #x00000200)
(define SDL-INIT-HAPTIC         #x00001000)
(define SDL-INIT-GAMECONTROLLER #x00002000)
(define SDL-INIT-EVENTS         #x00004000)
(define SDL-INIT-EVERYTHING
  (bitwise-ior SDL-INIT-TIMER
               SDL-INIT-AUDIO
               SDL-INIT-VIDEO
               SDL-INIT-EVENTS
               SDL-INIT-JOYSTICK
               SDL-INIT-HAPTIC
               SDL-INIT-GAMECONTROLLER))

(define SDL-HINT-DEFAULT  0)
(define SDL-HINT-NORMAL   1)
(define SDL-HINT-OVERRIDE 2)

(define SDL-HINT-FRAMEBUFFER-ACCELERATION                 "SDL_FRAMEBUFFER_ACCELERATION")
(define SDL-HINT-RENDER-DRIVER                            "SDL_RENDER_DRIVER")
(define SDL-HINT-RENDER-OPENGL-SHADERS                    "SDL_RENDER_OPENGL_SHADERS")
(define SDL-HINT-RENDER-DIRECT3D-THREADSAFE               "SDL_RENDER_DIRECT3D_THREADSAFE")
(define SDL-HINT-RENDER-DIRECT3D11-DEBUG                  "SDL_RENDER_DIRECT3D11_DEBUG")
(define SDL-HINT-RENDER-LOGICAL-SIZE-MODE                 "SDL_RENDER_LOGICAL_SIZE_MODE")
(define SDL-HINT-RENDER-SCALE-QUALITY                     "SDL_RENDER_SCALE_QUALITY")
(define SDL-HINT-RENDER-VSYNC                             "SDL_RENDER_VSYNC")
(define SDL-HINT-VIDEO-ALLOW-SCREENSAVER                  "SDL_VIDEO_ALLOW_SCREENSAVER")
(define SDL-HINT-VIDEO-X11-XVIDMODE                       "SDL_VIDEO_X11_XVIDMODE")
(define SDL-HINT-VIDEO-X11-XINERAMA                       "SDL_VIDEO_X11_XINERAMA")
(define SDL-HINT-VIDEO-X11-XRANDR                         "SDL_VIDEO_X11_XRANDR")
(define SDL-HINT-VIDEO-X11-NET-WM-PING                    "SDL_VIDEO_X11_NET_WM_PING")
(define SDL-HINT-VIDEO-X11-NET-WM-BYPASS-COMPOSITOR       "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR")
(define SDL-HINT-WINDOW-FRAME-USABLE-WHILE-CURSOR-HIDDEN  "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN")
(define SDL-HINT-WINDOWS-INTRESOURCE-ICON                 "SDL_WINDOWS_INTRESOURCE_ICON")
(define SDL-HINT-WINDOWS-INTRESOURCE-ICON-SMALL           "SDL_WINDOWS_INTRESOURCE_ICON_SMALL")
(define SDL-HINT-WINDOWS-ENABLE-MESSAGELOOP               "SDL_WINDOWS_ENABLE_MESSAGELOOP")
(define SDL-HINT-GRAB-KEYBOARD                            "SDL_GRAB_KEYBOARD")
(define SDL-HINT-MOUSE-NORMAL-SPEED-SCALE                 "SDL_MOUSE_NORMAL_SPEED_SCALE")
(define SDL-HINT-MOUSE-RELATIVE-SPEED-SCALE               "SDL_MOUSE_RELATIVE_SPEED_SCALE")
(define SDL-HINT-MOUSE-RELATIVE-MODE-WARP                 "SDL_MOUSE_RELATIVE_MODE_WARP")
(define SDL-HINT-MOUSE-FOCUS-CLICKTHROUGH                 "SDL_MOUSE_FOCUS_CLICKTHROUGH")
(define SDL-HINT-TOUCH-MOUSE-EVENTS                       "SDL_TOUCH_MOUSE_EVENTS")
(define SDL-HINT-VIDEO-MINIMIZE-ON-FOCUS-LOSS             "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS")
(define SDL-HINT-IDLE-TIMER-DISABLED                      "SDL_IOS_IDLE_TIMER_DISABLED")
(define SDL-HINT-ORIENTATIONS                             "SDL_IOS_ORIENTATIONS")
(define SDL-HINT-APPLE-TV-CONTROLLER-UI-EVENTS            "SDL_APPLE_TV_CONTROLLER_UI_EVENTS")
(define SDL-HINT-APPLE-TV-REMOTE-ALLOW-ROTATION           "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION")
(define SDL-HINT-IOS-HIDE-HOME-INDICATOR                  "SDL_IOS_HIDE_HOME_INDICATOR")
(define SDL-HINT-ACCELEROMETER-AS-JOYSTICK                "SDL_ACCELEROMETER_AS_JOYSTICK")
(define SDL-HINT-TV-REMOTE-AS-JOYSTICK                    "SDL_TV_REMOTE_AS_JOYSTICK")
(define SDL-HINT-XINPUT-ENABLED                           "SDL_XINPUT_ENABLED")
(define SDL-HINT-XINPUT-USE-OLD-JOYSTICK-MAPPING          "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING")
(define SDL-HINT-GAMECONTROLLERCONFIG                     "SDL_GAMECONTROLLERCONFIG")
(define SDL-HINT-GAMECONTROLLER-IGNORE-DEVICES            "SDL_GAMECONTROLLER_IGNORE_DEVICES")
(define SDL-HINT-GAMECONTROLLER-IGNORE-DEVICES-EXCEPT     "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT")
(define SDL-HINT-JOYSTICK-ALLOW-BACKGROUND-EVENTS         "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS")
(define SDL-HINT-ALLOW-TOPMOST                            "SDL_ALLOW_TOPMOST")
(define SDL-HINT-TIMER-RESOLUTION                         "SDL_TIMER_RESOLUTION")
(define SDL-HINT-QTWAYLAND-CONTENT-ORIENTATION            "SDL_QTWAYLAND_CONTENT_ORIENTATION")
(define SDL-HINT-QTWAYLAND-WINDOW-FLAGS                   "SDL_QTWAYLAND_WINDOW_FLAGS")
(define SDL-HINT-THREAD-STACK-SIZE                        "SDL_THREAD_STACK_SIZE")
(define SDL-HINT-VIDEO-HIGHDPI-DISABLED                   "SDL_VIDEO_HIGHDPI_DISABLED")
(define SDL-HINT-MAC-CTRL-CLICK-EMULATE-RIGHT-CLICK       "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK")
(define SDL-HINT-VIDEO-WIN-D3DCOMPILER                    "SDL_VIDEO_WIN_D3DCOMPILER")
(define SDL-HINT-VIDEO-WINDOW-SHARE-PIXEL-FORMAT          "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT")
(define SDL-HINT-WINRT-PRIVACY-POLICY-URL                 "SDL_WINRT_PRIVACY_POLICY_URL")
(define SDL-HINT-WINRT-PRIVACY-POLICY-LABEL               "SDL_WINRT_PRIVACY_POLICY_LABEL")
(define SDL-HINT-WINRT-HANDLE-BACK-BUTTON                 "SDL_WINRT_HANDLE_BACK_BUTTON")
(define SDL-HINT-VIDEO-MAC-FULLSCREEN-SPACES              "SDL_VIDEO_MAC_FULLSCREEN_SPACES")
(define SDL-HINT-MAC-BACKGROUND-APP                       "SDL_MAC_BACKGROUND_APP")
(define SDL-HINT-ANDROID-APK-EXPANSION-MAIN-FILE-VERSION  "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION")
(define SDL-HINT-ANDROID-APK-EXPANSION-PATCH-FILE-VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION")
(define SDL-HINT-IME-INTERNAL-EDITING                     "SDL_IME_INTERNAL_EDITING")
(define SDL-HINT-ANDROID-SEPARATE-MOUSE-AND-TOUCH         "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH")
(define SDL-HINT-ANDROID-TRAP-BACK-BUTTON                 "SDL_ANDROID_TRAP_BACK_BUTTON")
(define SDL-HINT-RETURN-KEY-HIDES-IME                     "SDL_RETURN_KEY_HIDES_IME")
(define SDL-HINT-EMSCRIPTEN-KEYBOARD-ELEMENT              "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT")
(define SDL-HINT-NO-SIGNAL-HANDLERS                       "SDL_NO_SIGNAL_HANDLERS")
(define SDL-HINT-WINDOWS-NO-CLOSE-ON-ALT-F4               "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4")
(define SDL-HINT-BMP-SAVE-LEGACY-FORMAT                   "SDL_BMP_SAVE_LEGACY_FORMAT")
(define SDL-HINT-WINDOWS-DISABLE-THREAD-NAMING            "SDL_WINDOWS_DISABLE_THREAD_NAMING")
(define SDL-HINT-RPI-VIDEO-LAYER                          "SDL_RPI_VIDEO_LAYER")
(define SDL-HINT-VIDEO-DOUBLE-BUFFER                      "SDL_VIDEO_DOUBLE_BUFFER")
(define SDL-HINT-OPENGL-ES-DRIVER                         "SDL_OPENGL_ES_DRIVER")
(define SDL-HINT-AUDIO-RESAMPLING-MODE                    "SDL_AUDIO_RESAMPLING_MODE")
(define SDL-HINT-AUDIO-CATEGORY                           "SDL_AUDIO_CATEGORY")

(define SDL-WINDOW-FULLSCREEN         #x00000001)
(define SDL-WINDOW-OPENGL             #x00000002)
(define SDL-WINDOW-SHOWN              #x00000004)
(define SDL-WINDOW-HIDDEN             #x00000008)
(define SDL-WINDOW-BORDERLESS         #x00000010)
(define SDL-WINDOW-RESIZABLE          #x00000020)
(define SDL-WINDOW-MINIMIZED          #x00000040)
(define SDL-WINDOW-MAXIMIZED          #x00000080)
(define SDL-WINDOW-INPUT-GRABBED      #x00000100)
(define SDL-WINDOW-INPUT-FOCUS        #x00000200)
(define SDL-WINDOW-MOUSE-FOCUS        #x00000400)
(define SDL-WINDOW-FULLSCREEN-DESKTOP (bitwise-ior SDL-WINDOW-FULLSCREEN #x00001000))
(define SDL-WINDOW-FOREIGN            #x00000800)
(define SDL-WINDOW-ALLOW-HIGHDPI      #x00002000)
(define SDL-WINDOW-MOUSE-CAPTURE      #x00004000)
(define SDL-WINDOW-ALWAYS-ON-TOP      #x00008000)
(define SDL-WINDOW-SKIP-TASKBAR       #x00010000)
(define SDL-WINDOW-UTILITY            #x00020000)
(define SDL-WINDOW-TOOLTIP            #x00040000)
(define SDL-WINDOW-POPUP-MENU         #x00080000)
(define SDL-WINDOW-VULKAN             #x10000000)

(define SDL-WINDOWPOS-UNDEFINED-MASK #x1FFF0000)

(define (SDL-WINDOWPOS-UNDEFINED-DISPLAY X)
  (bitwise-ior SDL-WINDOWPOS-UNDEFINED-MASK X))

(define SDL-WINDOWPOS-UNDEFINED
  (SDL-WINDOWPOS-UNDEFINED-DISPLAY 0))

(define (SDL-WINDOWPOS-IS-UNDEFINED? X)
  (= (bitwise-and X #xFFFF0000) SDL-WINDOWPOS-UNDEFINED-MASK))

(define SDL-WINDOWPOS-CENTERED-MASK #x2FFF0000)

(define (SDL-WINDOWPOS-CENTERED-DISPLAY X)
  (bitwise-ior SDL-WINDOWPOS-CENTERED-MASK X))

(define SDL-WINDOWPOS-CENTERED
  (SDL-WINDOWPOS-CENTERED-DISPLAY 0))

(define (SDL-WINDOWPOS-IS-CENTERED? X)
  (= (bitwise-and X #xFFFF0000) SDL-WINDOWPOS-CENTERED-MASK))

(define SDL-SWSURFACE #x00000000)
(define SDL-PREALLOC  #x00000001)
(define SDL-RLEACCEL  #x00000002)
(define SDL-DONTFREE  #x00000004)

(define SDL-GL-RED-SIZE                    0)
(define SDL-GL-GREEN-SIZE                  1)
(define SDL-GL-BLUE-SIZE                   2)
(define SDL-GL-ALPHA-SIZE                  3)
(define SDL-GL-BUFFER-SIZE                 4)
(define SDL-GL-DOUBLEBUFFER                5)
(define SDL-GL-DEPTH-SIZE                  6)
(define SDL-GL-STENCIL-SIZE                7)
(define SDL-GL-ACCUM-RED-SIZE              8)
(define SDL-GL-ACCUM-GREEN-SIZE            9)
(define SDL-GL-ACCUM-BLUE-SIZE            10)
(define SDL-GL-ACCUM-ALPHA-SIZE           11)
(define SDL-GL-STEREO                     12)
(define SDL-GL-MULTISAMPLEBUFFERS         13)
(define SDL-GL-MULTISAMPLESAMPLES         14)
(define SDL-GL-ACCELERATED-VISUAL         15)
(define SDL-GL-RETAINED-BACKING           16)
(define SDL-GL-CONTEXT-MAJOR-VERSION      17)
(define SDL-GL-CONTEXT-MINOR-VERSION      18)
(define SDL-GL-CONTEXT-EGL                19)
(define SDL-GL-CONTEXT-FLAGS              20)
(define SDL-GL-CONTEXT-PROFILE-MASK       21)
(define SDL-GL-SHARE-WITH-CURRENT-CONTEXT 22)
(define SDL-GL-FRAMEBUFFER-SRGB-CAPABLE   23)
(define SDL-GL-CONTEXT-RELEASE-BEHAVIOR   24)
(define SDL-GL-CONTEXT-RESET-NOTIFICATION 25)
(define SDL-GL-CONTEXT-NO-ERROR           26)

(define SDL-GL-CONTEXT-PROFILE-CORE          #x0001)
(define SDL-GL-CONTEXT-PROFILE-COMPATIBILITY #x0002)
(define SDL-GL-CONTEXT-PROFILE-ES            #x0004)

(define SDL-GL-CONTEXT-DEBUG-FLAG              #x0001)
(define SDL-GL-CONTEXT-FORWARD-COMPATIBLE-FLAG #x0002)
(define SDL-GL-CONTEXT-ROBUST-ACCESS-FLAG      #x0004)
(define SDL-GL-CONTEXT-RESET-ISOLATION-FLAG    #x0008)



(define SDL-AUDIO-MASK-BITSIZE       #xFF)
(define SDL-AUDIO-MASK-DATATYPE      (bitwise-arithmetic-shift-left 1 8))
(define SDL-AUDIO-MASK-ENDIAN        (bitwise-arithmetic-shift-left 1 12))
(define SDL-AUDIO-MASK-SIGNED        (bitwise-arithmetic-shift-left 1 15))
(define (SDL-AUDIO-BITSIZE x)        (bitwise-and x SDL-AUDIO-MASK-BITSIZE))
(define (SDL-AUDIO-ISFLOAT x)        (> (bitwise-and x SDL-AUDIO-MASK-DATATYPE) 0))
(define (SDL-AUDIO-ISBIGENDIAN x)    (> (bitwise-and x SDL-AUDIO-MASK-ENDIAN) 0))
(define (SDL-AUDIO-ISSIGNED x)       (> (bitwise-and x SDL-AUDIO-MASK-SIGNED) 0))
(define (SDL-AUDIO-ISINT x)          (not (SDL-AUDIO-ISFLOAT x)))
(define (SDL-AUDIO-ISLITTLEENDIAN x) (not (SDL-AUDIO-ISBIGENDIAN x)))
(define (SDL-AUDIO-ISUNSIGNED x)     (not (SDL-AUDIO-ISSIGNED x)))

(define AUDIO-U8        #x0008)
(define AUDIO-S8        #x8008)
(define AUDIO-U16LSB    #x0010)
(define AUDIO-S16LSB    #x8010)
(define AUDIO-U16MSB    #x1010)
(define AUDIO-S16MSB    #x9010)
(define AUDIO-U16       AUDIO-U16LSB)
(define AUDIO-S16       AUDIO-S16LSB)

(define AUDIO-S32LSB    #x8020)
(define AUDIO-S32MSB    #x9020)
(define AUDIO-S32       AUDIO-S32LSB)

(define AUDIO-F32LSB    #x8120)
(define AUDIO-F32MSB    #x9120)
(define AUDIO-F32       AUDIO-F32LSB)

(define AUDIO-U16SYS (if (eq? (native-endianness) 'little) AUDIO-U16LSB AUDIO-U16MSB))
(define AUDIO-S16SYS (if (eq? (native-endianness) 'little) AUDIO-S16LSB AUDIO-S16MSB))
(define AUDIO-S32SYS (if (eq? (native-endianness) 'little) AUDIO-S32LSB AUDIO-S32MSB))
(define AUDIO-F32SYS (if (eq? (native-endianness) 'little) AUDIO-F32LSB AUDIO-F32MSB))

(define SDL-AUDIO-ALLOW-FREQUENCY-CHANGE    #x00000001)
(define SDL-AUDIO-ALLOW-FORMAT-CHANGE       #x00000002)
(define SDL-AUDIO-ALLOW-CHANNELS-CHANGE     #x00000004)
(define SDL-AUDIO-ALLOW-SAMPLES-CHANGE      #x00000008)
(define SDL-AUDIO-ALLOW-ANY-CHANGE          (bitwise-ior SDL-AUDIO-ALLOW-FREQUENCY-CHANGE
							 SDL-AUDIO-ALLOW-FORMAT-CHANGE
							 SDL-AUDIO-ALLOW-CHANNELS-CHANGE
							 SDL-AUDIO-ALLOW-SAMPLES-CHANGE))



(define SDL-SCANCODE-UNKNOWN 0)
(define SDL-SCANCODE-A 4)
(define SDL-SCANCODE-B 5)
(define SDL-SCANCODE-C 6)
(define SDL-SCANCODE-D 7)
(define SDL-SCANCODE-E 8)
(define SDL-SCANCODE-F 9)
(define SDL-SCANCODE-G 10)
(define SDL-SCANCODE-H 11)
(define SDL-SCANCODE-I 12)
(define SDL-SCANCODE-J 13)
(define SDL-SCANCODE-K 14)
(define SDL-SCANCODE-L 15)
(define SDL-SCANCODE-M 16)
(define SDL-SCANCODE-N 17)
(define SDL-SCANCODE-O 18)
(define SDL-SCANCODE-P 19)
(define SDL-SCANCODE-Q 20)
(define SDL-SCANCODE-R 21)
(define SDL-SCANCODE-S 22)
(define SDL-SCANCODE-T 23)
(define SDL-SCANCODE-U 24)
(define SDL-SCANCODE-V 25)
(define SDL-SCANCODE-W 26)
(define SDL-SCANCODE-X 27)
(define SDL-SCANCODE-Y 28)
(define SDL-SCANCODE-Z 29)

(define SDL-SCANCODE-1 30)
(define SDL-SCANCODE-2 31)
(define SDL-SCANCODE-3 32)
(define SDL-SCANCODE-4 33)
(define SDL-SCANCODE-5 34)
(define SDL-SCANCODE-6 35)
(define SDL-SCANCODE-7 36)
(define SDL-SCANCODE-8 37)
(define SDL-SCANCODE-9 38)
(define SDL-SCANCODE-0 39)

(define SDL-SCANCODE-RETURN    40)
(define SDL-SCANCODE-ESCAPE    41)
(define SDL-SCANCODE-BACKSPACE 42)
(define SDL-SCANCODE-TAB       43)
(define SDL-SCANCODE-SPACE     44)

(define SDL-SCANCODE-MINUS        45)
(define SDL-SCANCODE-EQUALS       46)
(define SDL-SCANCODE-LEFTBRACKET  47)
(define SDL-SCANCODE-RIGHTBRACKET 48)
(define SDL-SCANCODE-BACKSLASH    49)

(define SDL-SCANCODE-NONUSHASH  50)
(define SDL-SCANCODE-SEMICOLON  51)
(define SDL-SCANCODE-APOSTROPHE 52)
(define SDL-SCANCODE-GRAVE      53)
(define SDL-SCANCODE-COMMA      54)
(define SDL-SCANCODE-PERIOD     55)
(define SDL-SCANCODE-SLASH      56)

(define SDL-SCANCODE-CAPSLOCK 57)

(define SDL-SCANCODE-F1  58)
(define SDL-SCANCODE-F2  59)
(define SDL-SCANCODE-F3  60)
(define SDL-SCANCODE-F4  61)
(define SDL-SCANCODE-F5  62)
(define SDL-SCANCODE-F6  63)
(define SDL-SCANCODE-F7  64)
(define SDL-SCANCODE-F8  65)
(define SDL-SCANCODE-F9  66)
(define SDL-SCANCODE-F10 67)
(define SDL-SCANCODE-F11 68)
(define SDL-SCANCODE-F12 69)

(define SDL-SCANCODE-PRINTSCREEN 70)
(define SDL-SCANCODE-SCROLLLOCK  71)
(define SDL-SCANCODE-PAUSE       72)
(define SDL-SCANCODE-INSERT      73)
(define SDL-SCANCODE-HOME        74)
(define SDL-SCANCODE-PAGEUP      75)
(define SDL-SCANCODE-DELETE      76)
(define SDL-SCANCODE-END         77)
(define SDL-SCANCODE-PAGEDOWN    78)
(define SDL-SCANCODE-RIGHT       79)
(define SDL-SCANCODE-LEFT        80)
(define SDL-SCANCODE-DOWN        81)
(define SDL-SCANCODE-UP          82)

(define SDL-SCANCODE-NUMLOCKCLEAR 83)
(define SDL-SCANCODE-KP-DIVIDE    84)
(define SDL-SCANCODE-KP-MULTIPLY  85)
(define SDL-SCANCODE-KP-MINUS     86)
(define SDL-SCANCODE-KP-PLUS      87)
(define SDL-SCANCODE-KP-ENTER     88)
(define SDL-SCANCODE-KP-1         89)
(define SDL-SCANCODE-KP-2         90)
(define SDL-SCANCODE-KP-3         91)
(define SDL-SCANCODE-KP-4         92)
(define SDL-SCANCODE-KP-5         93)
(define SDL-SCANCODE-KP-6         94)
(define SDL-SCANCODE-KP-7         95)
(define SDL-SCANCODE-KP-8         96)
(define SDL-SCANCODE-KP-9         97)
(define SDL-SCANCODE-KP-0         98)
(define SDL-SCANCODE-KP-PERIOD    99)

(define SDL-SCANCODE-NONUSBACKSLASH 100)
(define SDL-SCANCODE-APPLICATION    101)
(define SDL-SCANCODE-POWER          102)
(define SDL-SCANCODE-KP-EQUALS      103)
(define SDL-SCANCODE-F13            104)
(define SDL-SCANCODE-F14            105)
(define SDL-SCANCODE-F15            106)
(define SDL-SCANCODE-F16            107)
(define SDL-SCANCODE-F17            108)
(define SDL-SCANCODE-F18            109)
(define SDL-SCANCODE-F19            110)
(define SDL-SCANCODE-F20            111)
(define SDL-SCANCODE-F21            112)
(define SDL-SCANCODE-F22            113)
(define SDL-SCANCODE-F23            114)
(define SDL-SCANCODE-F24            115)
(define SDL-SCANCODE-EXECUTE        116)
(define SDL-SCANCODE-HELP           117)
(define SDL-SCANCODE-MENU           118)
(define SDL-SCANCODE-SELECT         119)
(define SDL-SCANCODE-STOP           120)
(define SDL-SCANCODE-AGAIN          121)
(define SDL-SCANCODE-UNDO           122)
(define SDL-SCANCODE-CUT            123)
(define SDL-SCANCODE-COPY           124)
(define SDL-SCANCODE-PASTE          125)
(define SDL-SCANCODE-FIND           126)
(define SDL-SCANCODE-MUTE           127)
(define SDL-SCANCODE-VOLUMEUP       128)
(define SDL-SCANCODE-VOLUMEDOWN     129)
(define SDL-SCANCODE-KP-COMMA       133)
(define SDL-SCANCODE-KP-EQUALSAS400 134)

(define SDL-SCANCODE-INTERNATIONAL1 135)
(define SDL-SCANCODE-INTERNATIONAL2 136)
(define SDL-SCANCODE-INTERNATIONAL3 137)
(define SDL-SCANCODE-INTERNATIONAL4 138)
(define SDL-SCANCODE-INTERNATIONAL5 139)
(define SDL-SCANCODE-INTERNATIONAL6 140)
(define SDL-SCANCODE-INTERNATIONAL7 141)
(define SDL-SCANCODE-INTERNATIONAL8 142)
(define SDL-SCANCODE-INTERNATIONAL9 143)
(define SDL-SCANCODE-LANG1          144)
(define SDL-SCANCODE-LANG2          145)
(define SDL-SCANCODE-LANG3          146)
(define SDL-SCANCODE-LANG4          147)
(define SDL-SCANCODE-LANG5          148)
(define SDL-SCANCODE-LANG6          149)
(define SDL-SCANCODE-LANG7          150)
(define SDL-SCANCODE-LANG8          151)
(define SDL-SCANCODE-LANG9          152)

(define SDL-SCANCODE-ALTERASE   153)
(define SDL-SCANCODE-SYSREQ     154)
(define SDL-SCANCODE-CANCEL     155)
(define SDL-SCANCODE-CLEAR      156)
(define SDL-SCANCODE-PRIOR      157)
(define SDL-SCANCODE-RETURN2    158)
(define SDL-SCANCODE-SEPARATOR  159)
(define SDL-SCANCODE-OUT        160)
(define SDL-SCANCODE-OPER       161)
(define SDL-SCANCODE-CLEARAGAIN 162)
(define SDL-SCANCODE-CRSEL      163)
(define SDL-SCANCODE-EXSEL      164)

(define SDL-SCANCODE-KP-00              176)
(define SDL-SCANCODE-KP-000             177)
(define SDL-SCANCODE-THOUSANDSSEPARATOR 178)
(define SDL-SCANCODE-DECIMALSEPARATOR   179)
(define SDL-SCANCODE-CURRENCYUNIT       180)
(define SDL-SCANCODE-CURRENCYSUBUNIT    181)
(define SDL-SCANCODE-KP-LEFTPAREN       182)
(define SDL-SCANCODE-KP-RIGHTPAREN      183)
(define SDL-SCANCODE-KP-LEFTBRACE       184)
(define SDL-SCANCODE-KP-RIGHTBRACE      185)
(define SDL-SCANCODE-KP-TAB             186)
(define SDL-SCANCODE-KP-BACKSPACE       187)
(define SDL-SCANCODE-KP-A               188)
(define SDL-SCANCODE-KP-B               189)
(define SDL-SCANCODE-KP-C               190)
(define SDL-SCANCODE-KP-D               191)
(define SDL-SCANCODE-KP-E               192)
(define SDL-SCANCODE-KP-F               193)
(define SDL-SCANCODE-KP-XOR             194)
(define SDL-SCANCODE-KP-POWER           195)
(define SDL-SCANCODE-KP-PERCENT         196)
(define SDL-SCANCODE-KP-LESS            197)
(define SDL-SCANCODE-KP-GREATER         198)
(define SDL-SCANCODE-KP-AMPERSAND       199)
(define SDL-SCANCODE-KP-DBLAMPERSAND    200)
(define SDL-SCANCODE-KP-VERTICALBAR     201)
(define SDL-SCANCODE-KP-DBLVERTICALBAR  202)
(define SDL-SCANCODE-KP-COLON           203)
(define SDL-SCANCODE-KP-HASH            204)
(define SDL-SCANCODE-KP-SPACE           205)
(define SDL-SCANCODE-KP-AT              206)
(define SDL-SCANCODE-KP-EXCLAM          207)
(define SDL-SCANCODE-KP-MEMSTORE        208)
(define SDL-SCANCODE-KP-MEMRECALL       209)
(define SDL-SCANCODE-KP-MEMCLEAR        210)
(define SDL-SCANCODE-KP-MEMADD          211)
(define SDL-SCANCODE-KP-MEMSUBTRACT     212)
(define SDL-SCANCODE-KP-MEMMULTIPLY     213)
(define SDL-SCANCODE-KP-MEMDIVIDE       214)
(define SDL-SCANCODE-KP-PLUSMINUS       215)
(define SDL-SCANCODE-KP-CLEAR           216)
(define SDL-SCANCODE-KP-CLEARENTRY      217)
(define SDL-SCANCODE-KP-BINARY          218)
(define SDL-SCANCODE-KP-OCTAL           219)
(define SDL-SCANCODE-KP-DECIMAL         220)
(define SDL-SCANCODE-KP-HEXADECIMAL     221)

(define SDL-SCANCODE-LCTRL  224)
(define SDL-SCANCODE-LSHIFT 225)
(define SDL-SCANCODE-LALT   226)
(define SDL-SCANCODE-LGUI   227)
(define SDL-SCANCODE-RCTRL  228)
(define SDL-SCANCODE-RSHIFT 229)
(define SDL-SCANCODE-RALT   230)
(define SDL-SCANCODE-RGUI   231)

(define SDL-SCANCODE-MODE 257)

(define SDL-SCANCODE-AUDIONEXT    258)
(define SDL-SCANCODE-AUDIOPREV    259)
(define SDL-SCANCODE-AUDIOSTOP    260)
(define SDL-SCANCODE-AUDIOPLAY    261)
(define SDL-SCANCODE-AUDIOMUTE    262)
(define SDL-SCANCODE-MEDIASELECT  263)
(define SDL-SCANCODE-WWW          264)
(define SDL-SCANCODE-MAIL         265)
(define SDL-SCANCODE-CALCULATOR   266)
(define SDL-SCANCODE-COMPUTER     267)
(define SDL-SCANCODE-AC-SEARCH    268)
(define SDL-SCANCODE-AC-HOME      269)
(define SDL-SCANCODE-AC-BACK      270)
(define SDL-SCANCODE-AC-FORWARD   271)
(define SDL-SCANCODE-AC-STOP      272)
(define SDL-SCANCODE-AC-REFRESH   273)
(define SDL-SCANCODE-AC-BOOKMARKS 274)

(define SDL-SCANCODE-BRIGHTNESSDOWN 275)
(define SDL-SCANCODE-BRIGHTNESSUP   276)
(define SDL-SCANCODE-DISPLAYSWITCH  277)
(define SDL-SCANCODE-KBDILLUMTOGGLE 278)
(define SDL-SCANCODE-KBDILLUMDOWN   279)
(define SDL-SCANCODE-KBDILLUMUP     280)
(define SDL-SCANCODE-EJECT          281)
(define SDL-SCANCODE-SLEEP          282)

(define SDL-SCANCODE-APP1 283)
(define SDL-SCANCODE-APP2 284)

(define SDL-SCANCODE-AUDIOREWIND      285)
(define SDL-SCANCODE-AUDIOFASTFORWARD 286)

(define SDLK-SCANCODE-MASK          (bitwise-arithmetic-shift 1 30))
(define (SDL-SCANCODE-TO-KEYCODE X) (bitwise-ior X SDLK-SCANCODE-MASK))

(define SDLK-UNKNOWN 0)
(define SDLK-RETURN       (char->integer #\r))
(define SDLK-ESCAPE       (char->integer #\esc))
(define SDLK-BACKSPACE    (char->integer #\b))
(define SDLK-TAB          (char->integer #\t))
(define SDLK-SPACE        (char->integer #\space))
(define SDLK-EXCLAIM      (char->integer #\!))
(define SDLK-QUOTEDBL     (char->integer #\"))
(define SDLK-HASH         (char->integer #\#))
(define SDLK-PERCENT      (char->integer #\%))
(define SDLK-DOLLAR       (char->integer #\$))
(define SDLK-AMPERSAND    (char->integer #\&))
(define SDLK-QUOTE        (char->integer #\'))
(define SDLK-LEFTPAREN    (char->integer #\())
(define SDLK-RIGHTPAREN   (char->integer #\)))
(define SDLK-ASTERISK     (char->integer #\*))
(define SDLK-PLUS         (char->integer #\+))
(define SDLK-COMMA        (char->integer #\,))
(define SDLK-MINUS        (char->integer #\-))
(define SDLK-PERIOD       (char->integer #\.))
(define SDLK-SLASH        (char->integer #\/))
(define SDLK-0            (char->integer #\0))
(define SDLK-1            (char->integer #\1))
(define SDLK-2            (char->integer #\2))
(define SDLK-3            (char->integer #\3))
(define SDLK-4            (char->integer #\4))
(define SDLK-5            (char->integer #\5))
(define SDLK-6            (char->integer #\6))
(define SDLK-7            (char->integer #\7))
(define SDLK-8            (char->integer #\8))
(define SDLK-9            (char->integer #\9))
(define SDLK-COLON        (char->integer #\:))
(define SDLK-SEMICOLON    (char->integer #\;))
(define SDLK-LESS         (char->integer #\<))
(define SDLK-EQUALS       (char->integer #\=))
(define SDLK-GREATER      (char->integer #\>))
(define SDLK-QUESTION     (char->integer #\?))
(define SDLK-AT           (char->integer #\@))
(define SDLK-LEFTBRACKET  (char->integer #\[))
(define SDLK-BACKSLASH    (char->integer #\\))
(define SDLK-RIGHTBRACKET (char->integer #\]))
(define SDLK-CARET        (char->integer #\^))
(define SDLK-UNDERSCORE   (char->integer #\_))
(define SDLK-BACKQUOTE    (char->integer #\`))
(define SDLK-A            (char->integer #\a))
(define SDLK-B            (char->integer #\b))
(define SDLK-C            (char->integer #\c))
(define SDLK-D            (char->integer #\d))
(define SDLK-E            (char->integer #\e))
(define SDLK-F            (char->integer #\f))
(define SDLK-G            (char->integer #\g))
(define SDLK-H            (char->integer #\h))
(define SDLK-I            (char->integer #\i))
(define SDLK-J            (char->integer #\j))
(define SDLK-K            (char->integer #\k))
(define SDLK-L            (char->integer #\l))
(define SDLK-M            (char->integer #\m))
(define SDLK-N            (char->integer #\n))
(define SDLK-O            (char->integer #\o))
(define SDLK-P            (char->integer #\p))
(define SDLK-Q            (char->integer #\q))
(define SDLK-R            (char->integer #\r))
(define SDLK-S            (char->integer #\s))
(define SDLK-T            (char->integer #\t))
(define SDLK-U            (char->integer #\u))
(define SDLK-V            (char->integer #\v))
(define SDLK-W            (char->integer #\w))
(define SDLK-X            (char->integer #\x))
(define SDLK-Y            (char->integer #\y))
(define SDLK-Z            (char->integer #\z))

(define SDLK-CAPSLOCK (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CAPSLOCK))

(define SDLK-F1  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F1))
(define SDLK-F2  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F2))
(define SDLK-F3  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F3))
(define SDLK-F4  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F4))
(define SDLK-F5  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F5))
(define SDLK-F6  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F6))
(define SDLK-F7  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F7))
(define SDLK-F8  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F8))
(define SDLK-F9  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F9))
(define SDLK-F10 (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F10))
(define SDLK-F11 (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F11))
(define SDLK-F12 (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F12))

(define SDLK-PRINTSCREEN (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-PRINTSCREEN))
(define SDLK-SCROLLLOCK  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-SCROLLLOCK))
(define SDLK-PAUSE       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-PAUSE))
(define SDLK-INSERT      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-INSERT))
(define SDLK-HOME        (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-HOME))
(define SDLK-PAGEUP      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-PAGEUP))
(define SDLK-DELETE      (char->integer #\delete))
(define SDLK-END         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-END))
(define SDLK-PAGEDOWN    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-PAGEDOWN))
(define SDLK-RIGHT       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-RIGHT))
(define SDLK-LEFT        (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-LEFT))
(define SDLK-DOWN        (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-DOWN))
(define SDLK-UP          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-UP))

(define SDLK-NUMLOCKCLEAR (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-NUMLOCKCLEAR))
(define SDLK-KP-DIVIDE    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-DIVIDE))
(define SDLK-KP-MULTIPLY  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MULTIPLY))
(define SDLK-KP-MINUS     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MINUS))
(define SDLK-KP-PLUS      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-PLUS))
(define SDLK-KP-ENTER     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-ENTER))
(define SDLK-KP-1         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-1))
(define SDLK-KP-2         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-2))
(define SDLK-KP-3         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-3))
(define SDLK-KP-4         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-4))
(define SDLK-KP-5         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-5))
(define SDLK-KP-6         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-6))
(define SDLK-KP-7         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-7))
(define SDLK-KP-8         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-8))
(define SDLK-KP-9         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-9))
(define SDLK-KP-0         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-0))
(define SDLK-KP-PERIOD    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-PERIOD))

(define SDLK-APPLICATION    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-APPLICATION))
(define SDLK-POWER          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-POWER))
(define SDLK-KP-EQUALS      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-EQUALS))
(define SDLK-F13            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F13))
(define SDLK-F14            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F14))
(define SDLK-F15            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F15))
(define SDLK-F16            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F16))
(define SDLK-F17            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F17))
(define SDLK-F18            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F18))
(define SDLK-F19            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F19))
(define SDLK-F20            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F20))
(define SDLK-F21            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F21))
(define SDLK-F22            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F22))
(define SDLK-F23            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F23))
(define SDLK-F24            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-F24))
(define SDLK-EXECUTE        (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-EXECUTE))
(define SDLK-HELP           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-HELP))
(define SDLK-MENU           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-MENU))
(define SDLK-SELECT         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-SELECT))
(define SDLK-STOP           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-STOP))
(define SDLK-AGAIN          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AGAIN))
(define SDLK-UNDO           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-UNDO))
(define SDLK-CUT            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CUT))
(define SDLK-COPY           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-COPY))
(define SDLK-PASTE          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-PASTE))
(define SDLK-FIND           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-FIND))
(define SDLK-MUTE           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-MUTE))
(define SDLK-VOLUMEUP       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-VOLUMEUP))
(define SDLK-VOLUMEDOWN     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-VOLUMEDOWN))
(define SDLK-KP-COMMA       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-COMMA))
(define SDLK-KP-EQUALSAS400 (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-EQUALSAS400))

(define SDLK-ALTERASE   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-ALTERASE))
(define SDLK-SYSREQ     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-SYSREQ))
(define SDLK-CANCEL     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CANCEL))
(define SDLK-CLEAR      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CLEAR))
(define SDLK-PRIOR      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-PRIOR))
(define SDLK-RETURN2    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-RETURN2))
(define SDLK-SEPARATOR  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-SEPARATOR))
(define SDLK-OUT        (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-OUT))
(define SDLK-OPER       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-OPER))
(define SDLK-CLEARAGAIN (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CLEARAGAIN))
(define SDLK-CRSEL      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CRSEL))
(define SDLK-EXSEL      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-EXSEL))

(define SDLK-KP-00              (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-00))
(define SDLK-KP-000             (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-000))
(define SDLK-THOUSANDSSEPARATOR (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-THOUSANDSSEPARATOR))
(define SDLK-DECIMALSEPARATOR   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-DECIMALSEPARATOR))
(define SDLK-CURRENCYUNIT       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CURRENCYUNIT))
(define SDLK-CURRENCYSUBUNIT    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CURRENCYSUBUNIT))
(define SDLK-KP-LEFTPAREN       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-LEFTPAREN))
(define SDLK-KP-RIGHTPAREN      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-RIGHTPAREN))
(define SDLK-KP-LEFTBRACE       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-LEFTBRACE))
(define SDLK-KP-RIGHTBRACE      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-RIGHTBRACE))
(define SDLK-KP-TAB             (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-TAB))
(define SDLK-KP-BACKSPACE       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-BACKSPACE))
(define SDLK-KP-A               (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-A))
(define SDLK-KP-B               (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-B))
(define SDLK-KP-C               (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-C))
(define SDLK-KP-D               (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-D))
(define SDLK-KP-E               (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-E))
(define SDLK-KP-F               (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-F))
(define SDLK-KP-XOR             (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-XOR))
(define SDLK-KP-POWER           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-POWER))
(define SDLK-KP-PERCENT         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-PERCENT))
(define SDLK-KP-LESS            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-LESS))
(define SDLK-KP-GREATER         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-GREATER))
(define SDLK-KP-AMPERSAND       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-AMPERSAND))
(define SDLK-KP-DBLAMPERSAND    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-DBLAMPERSAND))
(define SDLK-KP-VERTICALBAR     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-VERTICALBAR))
(define SDLK-KP-DBLVERTICALBAR  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-DBLVERTICALBAR))
(define SDLK-KP-COLON           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-COLON))
(define SDLK-KP-HASH            (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-HASH))
(define SDLK-KP-SPACE           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-SPACE))
(define SDLK-KP-AT              (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-AT))
(define SDLK-KP-EXCLAM          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-EXCLAM))
(define SDLK-KP-MEMSTORE        (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MEMSTORE))
(define SDLK-KP-MEMRECALL       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MEMRECALL))
(define SDLK-KP-MEMCLEAR        (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MEMCLEAR))
(define SDLK-KP-MEMADD          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MEMADD))
(define SDLK-KP-MEMSUBTRACT     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MEMSUBTRACT))
(define SDLK-KP-MEMMULTIPLY     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MEMMULTIPLY))
(define SDLK-KP-MEMDIVIDE       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-MEMDIVIDE))
(define SDLK-KP-PLUSMINUS       (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-PLUSMINUS))
(define SDLK-KP-CLEAR           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-CLEAR))
(define SDLK-KP-CLEARENTRY      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-CLEARENTRY))
(define SDLK-KP-BINARY          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-BINARY))
(define SDLK-KP-OCTAL           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-OCTAL))
(define SDLK-KP-DECIMAL         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-DECIMAL))
(define SDLK-KP-HEXADECIMAL     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KP-HEXADECIMAL))

(define SDLK-LCTRL  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-LCTRL))
(define SDLK-LSHIFT (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-LSHIFT))
(define SDLK-LALT   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-LALT))
(define SDLK-LGUI   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-LGUI))
(define SDLK-RCTRL  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-RCTRL))
(define SDLK-RSHIFT (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-RSHIFT))
(define SDLK-RALT   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-RALT))
(define SDLK-RGUI   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-RGUI))

(define SDLK-MODE (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-MODE))

(define SDLK-AUDIONEXT    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AUDIONEXT))
(define SDLK-AUDIOPREV    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AUDIOPREV))
(define SDLK-AUDIOSTOP    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AUDIOSTOP))
(define SDLK-AUDIOPLAY    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AUDIOPLAY))
(define SDLK-AUDIOMUTE    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AUDIOMUTE))
(define SDLK-MEDIASELECT  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-MEDIASELECT))
(define SDLK-WWW          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-WWW))
(define SDLK-MAIL         (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-MAIL))
(define SDLK-CALCULATOR   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-CALCULATOR))
(define SDLK-COMPUTER     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-COMPUTER))
(define SDLK-AC-SEARCH    (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AC-SEARCH))
(define SDLK-AC-HOME      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AC-HOME))
(define SDLK-AC-BACK      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AC-BACK))
(define SDLK-AC-FORWARD   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AC-FORWARD))
(define SDLK-AC-STOP      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AC-STOP))
(define SDLK-AC-REFRESH   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AC-REFRESH))
(define SDLK-AC-BOOKMARKS (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AC-BOOKMARKS))

(define SDLK-BRIGHTNESSDOWN (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-BRIGHTNESSDOWN))
(define SDLK-BRIGHTNESSUP   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-BRIGHTNESSUP))
(define SDLK-DISPLAYSWITCH  (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-DISPLAYSWITCH))
(define SDLK-KBDILLUMTOGGLE (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KBDILLUMTOGGLE))
(define SDLK-KBDILLUMDOWN   (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KBDILLUMDOWN))
(define SDLK-KBDILLUMUP     (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-KBDILLUMUP))
(define SDLK-EJECT          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-EJECT))
(define SDLK-SLEEP          (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-SLEEP))
(define SDLK-APP1           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-APP1))
(define SDLK-APP2           (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-APP2))

(define SDLK-AUDIOREWIND      (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AUDIOREWIND))
(define SDLK-AUDIOFASTFORWARD (SDL-SCANCODE-TO-KEYCODE SDL-SCANCODE-AUDIOFASTFORWARD))

(define KMOD-NONE     #x0000)
(define KMOD-LSHIFT   #x0001)
(define KMOD-RSHIFT   #x0002)
(define KMOD-LCTRL    #x0040)
(define KMOD-RCTRL    #x0080)
(define KMOD-LALT     #x0100)
(define KMOD-RALT     #x0200)
(define KMOD-LGUI     #x0400)
(define KMOD-RGUI     #x0800)
(define KMOD-NUM      #x1000)
(define KMOD-CAPS     #x2000)
(define KMOD-MODE     #x4000)
(define KMOD-RESERVED #x8000)

(define KMOD-CTRL  (bitwise-ior KMOD-LCTRL  KMOD-RCTRL))
(define KMOD-SHIFT (bitwise-ior KMOD-LSHIFT KMOD-RSHIFT))
(define KMOD-ALT   (bitwise-ior KMOD-LALT   KMOD-RALT))
(define KMOD-GUI   (bitwise-ior KMOD-LGUI   KMOD-RGUI))



;;; ; ; ; ; ; ; ; ; ; ; ; ; ; ;;;
;;; Internal Data Definitions ;;;
;;; ; ; ; ; ; ; ; ; ; ; ; ; ; ;;;

(define SDL-FIRSTEVENT-E 0)

(define SDL-QUIT-E                    #x100)
(define SDL-APP-TERMINATING-E         #x101)
(define SDL-APP-LOWMEMORY-E           #x102)
(define SDL-APP-WILLENTERBACKGROUND-E #x103)
(define SDL-APP-DIDENTERBACKGROUND-E  #x104)
(define SDL-APP-WILLENTERFOREGROUND-E #x105)
(define SDL-APP-DIDENTERFOREGROUND-E  #x106)

(define SDL-WINDOWEVENT-E #x200)
(define SDL-SYSWMEVENT-E  #x201)

(define SDL-KEYDOWN-E       #x300)
(define SDL-KEYUP-E         #x301)
(define SDL-TEXTEDITING-E   #x302)
(define SDL-TEXTINPUT-E     #x303)
(define SDL-KEYMAPCHANGED-E #x304)

(define SDL-MOUSEMOTION-E     #x400)
(define SDL-MOUSEBUTTONDOWN-E #x401)
(define SDL-MOUSEBUTTONUP-E   #x402)
(define SDL-MOUSEWHEEL-E      #x403)

(define SDL-JOYAXISMOTION-E    #x600)
(define SDL-JOYBALLMOTION-E    #x601)
(define SDL-JOYHATMOTION-E     #x602)
(define SDL-JOYBUTTONDOWN-E    #x603)
(define SDL-JOYBUTTONUP-E      #x604)
(define SDL-JOYDEVICEADDED-E   #x605)
(define SDL-JOYDEVICEREMOVED-E #x606)

(define SDL-CONTROLLERAXISMOTION-E     #x650)
(define SDL-CONTROLLERBUTTONDOWN-E     #x651)
(define SDL-CONTROLLERBUTTONUP-E       #x652)
(define SDL-CONTROLLERDEVICEADDED-E    #x653)
(define SDL-CONTROLLERDEVICEREMOVED-E  #x654)
(define SDL-CONTROLLERDEVICEREMAPPED-E #x655)

(define SDL-FINGERDOWN-E   #x700)
(define SDL-FINGERUP-E     #x701)
(define SDL-FINGERMOTION-E #x702)

(define SDL-DOLLARGESTURE-E #x800)
(define SDL-DOLLARRECORD-E  #x801)
(define SDL-MULTIGESTURE-E  #x802)

(define SDL-CLIPBOARDUPDATE-E #x900)

(define SDL-DROPFILE-E     #x1000)
(define SDL-DROPTEXT-E     #x1001)
(define SDL-DROPBEGIN-E    #x1002)
(define SDL-DROPCOMPLETE-E #x1003)

(define SDL-AUDIODEVICEADDED-E   #x1100)
(define SDL-AUDIODEVICEREMOVED-E #x1101)

(define SDL-RENDER-TARGETS-RESET-E #x2000)
(define SDL-RENDER-DEVICE-RESET-E  #x2001)

(define SDL-USEREVENT-E #x8000)
(define SDL-LASTEVENT-E #xFFFF)

(define SDL-WINDOW-EVENT-SHOWN        1)
(define SDL-WINDOW-EVENT-HIDDEN       2)
(define SDL-WINDOW-EVENT-EXPOSED      3)
(define SDL-WINDOW-EVENT-MOVED        4)
(define SDL-WINDOW-EVENT-RESIZED      5)
(define SDL-WINDOW-EVENT-SIZE-CHANGED 6)
(define SDL-WINDOW-EVENT-MINIMIZED    7)
(define SDL-WINDOW-EVENT-MAXIMIZED    8)
(define SDL-WINDOW-EVENT-RESTORED     9)
(define SDL-WINDOW-EVENT-ENTER        10)
(define SDL-WINDOW-EVENT-LEAVE        11)
(define SDL-WINDOW-EVENT-FOCUS-GAINED 12)
(define SDL-WINDOW-EVENT-FOCUS-LOST   13)
(define SDL-WINDOW-EVENT-CLOSE        14)
(define SDL-WINDOW-EVENT-TAKE-FOCUS   15)
(define SDL-WINDOW-EVENT-HIT-TEST     16)
